---
title: AI/ML API
description: Learn how to use AI/ML API with Agno.
---

AI/ML API is a platform providing unified access to 300+ AI models including **Deepseek**, **Gemini**, **ChatGPT**, and more — with production-grade uptime and high rate limits.

## Authentication

Set your `AIMLAPI_API_KEY` environment variable. Get your key at [aimlapi.com](https://aimlapi.com/?utm_source=agno&utm_medium=github&utm_campaign=integration).

<CodeGroup>

```bash Mac
export AIMLAPI_API_KEY=***
```

```bash Windows
setx AIMLAPI_API_KEY ***
```

</CodeGroup>

## Example

Use `AI/ML API` with your `Agent`:

<CodeGroup>

```python agent.py
from agno.agent import Agent
from agno.models.aimlapi import AIMLAPI

agent = Agent(
    model=AIMLAPI(id="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo"),
    markdown=True,
)

agent.print_response("Explain how black holes are formed.")
```

</CodeGroup>

## Parameters

| Parameter    | Type               | Default                                        | Description                                                           |
| ------------ | ------------------ | ---------------------------------------------- | --------------------------------------------------------------------- |
| `id`         | `str`              | `"gpt-4o-mini"`                                | The id of the model to use                                            |
| `name`       | `str`              | `"AIMLAPI"`                                    | The name of the model                                                 |
| `provider`   | `str`              | `"AIMLAPI"`                                    | The provider of the model                                             |
| `api_key`    | `Optional[str]`    | `None`                                         | The API key for AI/ML API (defaults to AIMLAPI_API_KEY env var)      |
| `base_url`   | `str`              | `"https://api.aimlapi.com/v1"`                 | The base URL for the AI/ML API                                        |
| `max_tokens` | `int`              | `4096`                                         | Maximum number of tokens to generate                                  |

`AIMLAPI` extends the OpenAI-compatible interface and supports most parameters from the [OpenAI model](/concepts/models/openai), where applicable.

## Available Models

AI/ML API provides access to 300+ models. Some popular models include:

- **OpenAI Models**: `gpt-4o`, `gpt-4o-mini`, `o1`, `o1-mini`
- **Anthropic Models**: `claude-3-5-sonnet-20241022`, `claude-3-5-haiku-20241022`
- **Meta Models**: `meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo`, `meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo`
- **Google Models**: `gemini-1.5-pro`, `gemini-1.5-flash`
- **DeepSeek Models**: `deepseek-chat`, `deepseek-reasoner`

For a complete list of available models, visit the [AI/ML API documentation](https://docs.aimlapi.com/).
